
import 'dart:async';
import '../utils/ApiService.dart';
import 'definitions/ResultMomentModel.dart';
import 'definitions/MomentPublishParams.dart';
import 'definitions/ResultMomentListModel.dart';
import 'definitions/QueryMomentParams.dart';
import 'definitions/MomentCommentParams.dart';


class MomentController {

    static String publishMomentUsingPostPath = "/api/moment/publish";
    /// 1. 发布动态
    static Future<ResultMomentModel> publishMomentUsingPost(MomentPublishParams data,[ dynamic headers ]) async {
      var response = await ApiService.post("/api/moment/publish", data.toJson() , headers);
      return ResultMomentModel()..fromJson(response.data);
    }
    
    static String newsListUsingPostPath = "/api/moment/news_list";
    /// 2. 最新的动态列表
    static Future<ResultMomentListModel> newsListUsingPost(QueryMomentParams data,[ dynamic headers ]) async {
      var response = await ApiService.post("/api/moment/news_list", data.toJson() , headers);
      return ResultMomentListModel()..fromJson(response.data);
    }
    
    static String historyListUsingPostPath = "/api/moment/history_list";
    /// 3. 历史的动态列表
    static Future<ResultMomentListModel> historyListUsingPost(QueryMomentParams data,[ dynamic headers ]) async {
      var response = await ApiService.post("/api/moment/history_list", data.toJson() , headers);
      return ResultMomentListModel()..fromJson(response.data);
    }
    
    static String momentLikeUsingPostPath = "/api/moment/like/create/{id}";
    /// 4. 点赞动态
    static Future<ResultMomentModel> momentLikeUsingPost(String id, [ dynamic headers ]) async {
      var response = await ApiService.post("/api/moment/like/create/$id", null, headers);
      return ResultMomentModel()..fromJson(response.data);
    }
    
    static String momentCancelLikeUsingDeletePath = "/api/moment/like/remove/{id}";
    /// 5. 取消点赞动态
    static Future<ResultMomentModel> momentCancelLikeUsingDelete(String id, [dynamic headers]) async {
      var response = await ApiService.delete("/api/moment/like/remove/$id", {}, headers);
      return ResultMomentModel()..fromJson(response.data);
    }
    
    static String momentCommentUsingPostPath = "/api/moment/comment/create/{id}";
    /// 6. 评论动态
    static Future<ResultMomentModel> momentCommentUsingPost(String id, MomentCommentParams data,[ dynamic headers ]) async {
      var response = await ApiService.post("/api/moment/comment/create/$id", data.toJson() , headers);
      return ResultMomentModel()..fromJson(response.data);
    }
    
    static String removeMomentCommentUsingDeletePath = "/api/moment/comment/remove/{comment_id}";
    /// 7. 删除评论动态
    static Future<ResultMomentModel> removeMomentCommentUsingDelete(String comment_id, [dynamic headers]) async {
      var response = await ApiService.delete("/api/moment/comment/remove/$comment_id", {}, headers);
      return ResultMomentModel()..fromJson(response.data);
    }
    
    static String removeMomentUsingDeletePath = "/api/moment/remove/{id}";
    /// 8. 删除动态
    static Future<ResultMomentModel> removeMomentUsingDelete(String id, [dynamic headers]) async {
      var response = await ApiService.delete("/api/moment/remove/$id", {}, headers);
      return ResultMomentModel()..fromJson(response.data);
    }
    
    static String likeListUsingPostPath = "/api/moment/like_list";
    /// 9. 我点赞动态列表
    static Future<ResultMomentListModel> likeListUsingPost(QueryMomentParams data,[ dynamic headers ]) async {
      var response = await ApiService.post("/api/moment/like_list", data.toJson() , headers);
      return ResultMomentListModel()..fromJson(response.data);
    }
    
    static String myselfListUsingPostPath = "/api/moment/myself_list";
    /// 10. 我的动态列表
    static Future<ResultMomentListModel> myselfListUsingPost(QueryMomentParams data,[ dynamic headers ]) async {
      var response = await ApiService.post("/api/moment/myself_list", data.toJson() , headers);
      return ResultMomentListModel()..fromJson(response.data);
    }
    
}